package com.ruoyi.project.system.service.impl;

import com.ruoyi.project.system.domain.ResTable;
import com.ruoyi.project.system.mapper.ResTableMapper;
import com.ruoyi.project.system.service.ResTableService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * 预约主表 Service 实现（无 MyBatis-Plus，原生 MyBatis 调用）
 */
@Service
public class ResTableServiceImpl implements ResTableService {

    // 注入 Mapper（原生依赖注入）
    @Resource
    private ResTableMapper resTableMapper;

    @Override
    public boolean saveResTable(ResTable resTable) {
        // 调用 Mapper 插入数据，影响行数=1 则返回成功
        int rows = resTableMapper.insertResTable(resTable);
        return rows > 0;
    }
    
    @Override
    public List<ResTable> selectExistingReservation(Long doctorId, Long departmentId, Date datetime) {
        return resTableMapper.selectExistingReservation(doctorId, departmentId, datetime);
    }
}